package java101;

import java.io.*;
import java.util.*;

public class TenKWords {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(new File(
				"//Users//Meg//Downloads//10kwords.txt"));
		while (sc.hasNextLine()) {
			String[] numstrs = sc.nextLine().split("\\s+"); // split by white
																// space

			for (int i = 0; i <= numstrs.length; i++) { // increment through the
														// lines
				int up = 1;
				while (numstrs[i].length() > 3
						&& numstrs[i].charAt(up) > numstrs[i].charAt(up - 1)) {
					up++;
				}

				// else if (numstrs[i].charAt(up) > numstrs[i].charAt(up - 1)){
				// up = 1;

				// for (up = 1; (numstrs[i].charAt(up) > numstrs[i]
				// .charAt(up - 1)) && up < numstrs[i].length(); up++) { //
				// increment
				// through
				// the chars
				// on
				// each line

				if (up == numstrs[i].length()) {
					System.out.println(numstrs[i]);
				}

			}

		}
	}

}
